﻿using System;
using System.Diagnostics;
using ECommerce.IntegrationSpecs.Properties;

namespace ECommerce.IntegrationSpecs
{
    public static class SeleniumServer
    {
        private static Process seleniumServer;

        public static void Start()
        {
            seleniumServer = new Process();

            seleniumServer.StartInfo.FileName = "java";
            seleniumServer.StartInfo.Arguments = String.Format("-jar {0}", Settings.Default.SeleniumServerFilePath);
            seleniumServer.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            seleniumServer.Start();
        }

        public static void Stop()
        {
            if (seleniumServer != null)
            {
                seleniumServer.Close();
            }
        }
    }
}
